home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 January / enter-2004-01.iso / files / maxima-5.9.0.exe / {app} / share / maxima / 5.9.0 / tests / rtest2.mac < prev    next >
Encoding:
Text File  |  2003-02-09  |  2.5 KB  |  113 lines

  1. /*************** -*- Mode: MACSYMA; Package: MAXIMA -*-  ******************/
  2. /***************************************************************************
  3. ***                                                                    *****
  4. ***     Copyright (c) 1984 by William Schelter,University of Texas     *****
  5. ***     All rights reserved                                            *****
  6. ***************************************************************************/
  7.  
  8.  
  9. KILL(FUNCTIONS,ARRAYS,VALUES);
  10. DONE$
  11. use_fast_arrays:false;
  12. false;
  13. A[N]:=N*A[N-1];
  14. A[N]:=N*A[N-1]$
  15. A[0]:1;
  16. 1$
  17. A[5];
  18. 120$
  19. A[N]:=N;
  20. A[N]:=N$
  21. A[6];
  22. 6$
  23. A[4];
  24. 24$
  25. (use_fast_arrays:true,kill(a));
  26. done;
  27. LAMBDA([X,Y,Z],X^2+Y^2+Z^2);
  28. LAMBDA([X,Y,Z],X^2+Y^2+Z^2)$
  29. %(1,2,A);
  30. A^2+5$
  31. 1+2+A;
  32. A+3$
  33. EXP:[X^2,Y/3,-2];
  34. [X^2,Y/3,-2]$
  35. %[1]*X;
  36. X^3$
  37. [A,EXP,%];
  38. [A,[X^2,Y/3,-2],X^3]$
  39. M:MATRIX([A,0],[B,1]);
  40. MATRIX([A,0],[B,1])$
  41. M^2;
  42. MATRIX([A^2,0],[B^2,1])$
  43. EXP:M . M;
  44. MATRIX([A^2,0],[A*B+B,1])$
  45. M[1,1]*M;
  46. MATRIX([A^2,0],[A*B,A])$
  47. %-EXP+1;
  48. MATRIX([1,1],[1-B,A])$
  49. M^^(-1);
  50. MATRIX([1/A,0],[-B/A,1])$
  51. [X,Y] . M;
  52. MATRIX([B*Y+A*X,Y])$
  53. MATRIX([A,B,C],[D,E,F],[G,H,I]);
  54. MATRIX([A,B,C],[D,E,F],[G,H,I])$
  55. %^^2;
  56. MATRIX([C*G+B*D+A^2,C*H+B*E+A*B,C*I+B*F+A*C],
  57.        [F*G+D*E+A*D,F*H+E^2+B*D,F*I+E*F+C*D],
  58.        [G*I+D*H+A*G,H*I+E*H+B*G,I^2+F*H+C*G])$
  59. EXP:X+1 = Y^2;
  60. X+1 = Y^2$
  61. X-1 = 2*Y+1;
  62. X-1 = 2*Y+1$
  63. EXP+%;
  64. 2*X = Y^2+2*Y+1$
  65. EXP/Y;
  66. (X+1)/Y = Y$
  67. 1/%;
  68. Y/(X+1) = 1/Y$
  69. FIB[N]:=IF N = 1 OR N = 2 THEN 1 ELSE FIB[N-1]+FIB[N-2];
  70. FIB[N]:=IF N = 1 OR N = 2 THEN 1 ELSE FIB[N-1]+FIB[N-2]$
  71. FIB[1]+FIB[2];
  72. 2$
  73. FIB[3];
  74. 2$
  75. FIB[5];
  76. 5$
  77. ETA(MU,NU):=IF MU = NU THEN MU ELSE (IF MU > NU THEN MU-NU ELSE MU+NU);
  78. ETA(MU,NU):=IF MU = NU THEN MU ELSE (IF MU > NU THEN MU-NU ELSE MU+NU)$
  79. ETA(5,6);
  80. 11$
  81. ETA(ETA(7,7),ETA(1,2));
  82. 4$
  83. IF NOT 5 >= 2 AND 6 <= 5 OR 4+1 > 3 THEN A ELSE B;
  84. A$
  85. KILL(F);
  86. DONE$
  87. HESSIAN(F):=BLOCK([DFXX,DFXY,DFXZ,DFYY,DFYZ,DFZZ],DFXX:DIFF(F,X,2),
  88.     DFXY:DIFF(F,X,1,Y,1),DFXZ:DIFF(F,X,1,Z,1),DFYY:DIFF(F,Y,2),
  89.     DFYZ:DIFF(F,Y,1,Z,1),DFZZ:DIFF(F,Z,2),
  90.     DETERMINANT(MATRIX([DFXX,DFXY,DFXZ],[DFXY,DFYY,DFYZ],
  91.                [DFXZ,DFYZ,DFZZ])));
  92. HESSIAN(F):=BLOCK([DFXX,DFXY,DFXZ,DFYY,DFYZ,DFZZ],DFXX:DIFF(F,X,2),
  93.     DFXY:DIFF(F,X,1,Y,1),DFXZ:DIFF(F,X,1,Z,1),DFYY:DIFF(F,Y,2),
  94.     DFYZ:DIFF(F,Y,1,Z,1),DFZZ:DIFF(F,Z,2),
  95.     DETERMINANT(MATRIX([DFXX,DFXY,DFXZ],[DFXY,DFYY,DFYZ],
  96.                [DFXZ,DFYZ,DFZZ])))$
  97. KILL(X,Y,Z);
  98. DONE$
  99. HESSIAN(X^3-3*A*X*Y*Z+Y^3);
  100. -3*A*Y*(9*A^2*X*Z+18*A*Y^2)-27*A^3*X*Y*Z-54*A^2*X^3$
  101. SUBST(1,Z,QUOTIENT(%,-54*A^2));
  102. Y^3+A*X*Y+X^3$
  103. F(X):=BLOCK([a,Y],LOCAL(A),Y:4,A[Y]:X,DISPLAY(A[Y]));
  104. F(X):=BLOCK([a,Y],LOCAL(A),Y:4,A[Y]:X,DISPLAY(A[Y]))$
  105. Y:2;
  106. 2$
  107. A[Y+2]:0;
  108. 0$
  109. F(9);
  110. DONE$
  111. A[Y+2];
  112. 0$
  113.